package com.freejy.ecommunity.service;




import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.freejy.ecommunity.mapper.TopicMapper;
import com.freejy.ecommunity.model.Topic;

@Service
public class TopicService {

    private final Logger log = LoggerFactory.getLogger(TopicService.class);

    @Autowired
    private TopicMapper topicMapper;

    /**
     * 获取所有的帖子
     * @return
     */
    public List<Topic> getTopics(Integer size,Integer limit){
        return topicMapper.getTopics(size, limit);
    }


    /**
     * 根据板块id获取帖子
     * @return
     */
    public List<Topic> getTopicsByPlateId(Integer plateId, Integer size, Integer limit) {
        return topicMapper.getTopicsByPlateId(plateId, size, limit);
    }
    /**
     * 新增帖子
     * @return
     */
    public  int insert( Topic topic){
        return topicMapper.insert(topic);
    }

    /**
     * 修改帖子
     * @return
     */
    public  int updateById(Topic topic){
        return topicMapper.updateById(topic);
    }

}
